﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Project11
{
    class Object
    {      
        private Texture2D texture;
        public Texture2D Texture
        {
            get { return texture; }
            set { texture = value; }
        }
       
        private float  mass;
        public float Mass
        {
            get { return mass; }
            set { mass = value; }
        }

        private Vector2 position;
        public Vector2 Position
        {
            get { return position; }
            set { position = value; }
        }

        private float positionX;
        public float PositionX
        {
            get { return positionX; }
            set { positionX = value; }
        }

        private float positionY;
        public float PositionY
        {
            get { return positionY; }
            set { positionY = value; }
        }

        private Vector2 iVelocity;
        public Vector2 InitialVelocity
        {
            get { return iVelocity; }
            set { iVelocity = value; }
        }

        private Vector2 fVelocity;
        public Vector2 FinalVelocity
        {
            get { return fVelocity; }
            set { fVelocity = value; }
        }

        private Vector3 angularVelocity;
        public Vector3 AngularVelocity
        {
            get { return angularVelocity; }
            set { angularVelocity = value; }
        }

        private float angularDisplacement;
        public float AngularDisplacement
        {
            get { return angularDisplacement; }
            set { angularDisplacement = value; }
        }

        private Vector2 origin;
        public Vector2 Origin
        {
            get { return origin; }
            set { origin = value; }        
        }

        public Object(Texture2D texture, Vector2 position, float mass, Vector2 ivelocity)
        {
            this.texture = texture;
            this.positionX = position.X;
            this.positionY = position.Y;
            this.mass = mass;
            this.iVelocity = ivelocity;

            angularVelocity = Vector3.Zero;
            angularDisplacement = 0;           
            origin = new Vector2(texture.Width / 2, texture.Height / 2);
        }

        public void Draw(SpriteBatch spriteBatch, Vector2 offset)
        {
            spriteBatch.Draw(Texture, new Vector2(PositionX, PositionY) + offset, null, Color.White, AngularDisplacement, origin, 1f, SpriteEffects.None, 0f);
        }
    }
}
